<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.10/dist/vue.js"></script>
    <style>
      #app {
        font-family: Avenir, Helvetica, Arial, sans-serif;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        text-align: center;
        color: #2c3e50;
      }
    </style>
  </head>

  <body>
    <div id="app">
      <h1>欢迎来到比奇堡</h1>
      <ul>
        <button @click="person.unshift({id:'004',name:'珊迪'})">点击添加数据</button>
        <li v-for="item in person" :key="item.id"><h2>{{item.name}}</h2></li>
      </ul>
    </div>
    <script>
      Vue.config.productionTip = false;
      //实例化Vue
      const vm = new Vue({
        el: "#app",
        data() {
          return {
            person: [
              { id: "001", name: "派大星" },
              { id: "002", name: "海绵宝宝" },
              { id: "003", name: "章鱼哥" },
            ],
          };
        },
      });
    </script>
  </body>
</html>
